/*
基础网络材质（MeshBasicMaterial）

纹理基本属性
偏移，中心点，旋转，重复
offset，center,rotation,repeat

纹理显示算法
minFilter， magFilter

透明材质和透明算法
黑色0，白色1，材质属性alphaMap进行透明材质映射，transparent要打开，
背面渲染，side: THREE.DoubleSide

环境遮挡贴图
aoMap, 除了贴图，需要第二组uv，aoMapIntensity设置深浅
cubeGeometry.setAttribute(
  "uv2",
  new THREE.BufferAttribute(cubeGeometry.attributes.uv.array, 2)
)

*/
const textureLoader = new THREE.TextureLoader()
const doorColorTexture =  textureLoader.load('./textures/door/color.png')
const doorAplhaTexture = textureLoader.load('./textures/door/alpha.jpeg')
const doorAoTexture = textureLoader.load('./textures/door/ambientOcclusion.jpeg')

//设置纹理偏移
doorColorTexture.offset.x = 0.5;
doorColorTexture.offset.y = 0.5;
doorColorTexture.offset.set(0.5, 0.5);

//旋转中心点
doorColorTexture.center.set(0.5, 0.5);

//纹理旋转
doorColorTexture.rotation = Math.PI/4;

//纹理重复
doorColorTexture.repeat.set(2, 3);

//纹理重复方式
doorColorTexture.wrapS = THREE.MirroredRepeatWrapping;
doorColorTexture.wrapT = THREE.RepeatWrapping;

//纹理的显示算法
doorColorTexture.minFilter = THREE.NearestFilter;
doorColorTexture.magFilter = THREE.NearestFilter;
doorColorTexture.minFilter = THREE.LinearFilter;
doorColorTexture.magFilter = THREE.LinearFilter;

const basicMaterial = new THREE.MeshBasicMaterial({
  color: "#ffff00",
  map: doorColorTexture,
  alphaMap: doorAplhaTexture,
  transparent: true,
  side: THREE.DoubleSide,
  aoMap: doorAoTexture, //需要第二组uv
  aoMapIntensity: 0.5
})